package thread;

public class ThreadDemo15 {
    public static void main(String[] args) throws InterruptedException {
        Thread t=new Thread(()->{
            for(int i=0;i<5;i++)
            {
                System.out.println("线程正在运行中");
                try {
                    Thread.sleep(1000);
                } catch (InterruptedException e) {
                    throw new RuntimeException(e);
                }
            }
            System.out.println("线程结束");

        });
        //
        System.out.println("start之前"+t.getState());
        t.start();
        System.out.println("t.start之后"+t.getState());
        Thread.sleep(500);
        System.out.println("sleep中"+t.getState());
        t.join();
        System.out.println("结束之后"+t.getState());

    }
}
